package alvarodelrosal.chat.client.chataction.local;

import alvarodelrosal.chat.client.chataction.infraestructuraremota.AllUsers;
import alvarodelrosal.chat.client.chataction.infraestructuraremota.OnlineConversations;
import alvarodelrosal.chat.client.modelo.Conversation;
import java.util.List;

public class ChatAddToChat implements ChatLocalAction {

    @Override
    public String getName() {
        return "AddToChat";
    }

    @Override
    public void doAction(List<String> parameters) {
        int conversationId = Integer.parseInt(parameters.get(0));
        int userId = Integer.parseInt(parameters.get(1));
        Conversation conversation = OnlineConversations.getConversation(conversationId);
        conversation.addUser(AllUsers.getUser(userId));
    }
    
}
